#include<stdio.h>

int isSearch(int num, int d)
{
    if(num % d != 0)
    {
        return 0;
    }
    else
    {
        int digit = 0, k = 0, i;
        while(num != 0)
        {
            digit = num % 10;
            
            if(digit == d)
            {
                return 1;
            }
            
            num /= 10;
        }
    }
    
    return 0;
}

int main()
{
    int d, cnt = 0,m, n;
    scanf("%d %d %d", &d, &n, &m);

    int i;
    
    for(i = n; i <= m; i++)
    {
        if(isSearch(i, d))
        {
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}
